package windowsevent;

import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.JFrame;
import javax.swing.JLabel;

public class MouseListenerTest extends JFrame implements MouseListener {
	JLabel jl1, jl2, jl3;
	
	public MouseListenerTest() {
		setSize(300, 300);
		Container c = getContentPane();
		c.setLayout(new FlowLayout());
		jl1 = new JLabel("no event");
		jl2 = new JLabel("no event");
		jl3 = new JLabel("no event");
		c.add(jl1);
		addMouseListener(this);
	}

	@Override
	public void mouseClicked(MouseEvent e) {
		jl1.setText("mouse pressed at point:" + e.getX() + " "  + e.getY() + "mouse clicked:" + e.getClickCount());
	}

	@Override
	public void mouseEntered(MouseEvent e) {
		jl1.setText("mouse pressed at point:" + e.getX() + " "  + e.getY());
	}

	@Override
	public void mouseExited(MouseEvent e) {
		jl1.setText("mouse pressed at point:" + e.getX() + " "  + e.getY());
	}

	@Override
	public void mousePressed(MouseEvent e) {
		jl1.setText("mouse pressed at point:" + e.getX() + " "  + e.getY());
	}

	@Override
	public void mouseReleased(MouseEvent e) {
		jl1.setText("mouse pressed at point:" + e.getX() + " "  + e.getY());
	}
	public static void main(String[] args) {
		MouseListenerTest ml = new MouseListenerTest();
		ml.setVisible(true);
	}

}
